﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Hammock.Web;

namespace TMWS
{
	using Models;

	/// <summary>
	/// Solo ranking service
	/// </summary>
	public class SoloRankingService : ServiceBase
	{
		#region Constructors

		public SoloRankingService(string username, string password)
			: base(username, password)
		{
		}

		public SoloRankingService(string username, string password, bool enableLogging, string logDirectory)
			: base(username, password, enableLogging, logDirectory)
		{
		}

		#endregion

		#region Public Methods

		/// <summary>
		/// Gets player rankings for the specified path
		/// </summary>
		/// <param name="path">Zone path</param>
		/// <param name="offset">Offset</param>
		/// <param name="length">Length (items per 'page')</param>
		/// <returns>Player rankings</returns>
		public PlayerRanking GetPlayerRankings(string path = "World", int offset = 0, int length = 10)
		{
			string resource = String.Format("tmf/rankings/solo/players/{0}/?offset={1}&length={2}", path, offset, length);

			return Execute<PlayerRanking>(resource, WebMethod.Get);
		}

		/// <summary>
		/// Gets player rankings for the specified challenge
		/// </summary>
		/// <param name="uid">Challenge UID</param>
		/// <param name="path">Zone path</param>
		/// <param name="offset">Offset</param>
		/// <param name="length">Length</param>
		/// <returns></returns>
		public ChallengeRanking GetPlayerRankingsForChallenge(string uid, string path = "World", int offset = 0, int length = 10)
		{
			string resource = String.Format("tmf/rankings/solo/challenges/{0}/players/{1}/?offset={2}&length={3}", uid, path, offset, length);

			return Execute<ChallengeRanking>(resource, WebMethod.Get);
		}

		#endregion
	}
}